package com.mercury.ec.framework.air.core.client.impl.sunstn.dto.rtkt;

import com.mercury.ec.framework.air.core.client.impl.sunstn.jaxb.adapter.Boolean2XmlAdapter;
import com.mercury.ec.framework.air.core.client.impl.sunstn.jaxb.adapter.LocalEnglishDate2XmlAdapter;
import lombok.Data;

import javax.xml.bind.annotation.*;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.List;

/**
 * SUNSTN RTKT Response DTO
 *
 * @author hesx
 */
@Data
@XmlRootElement(name = "cmd")
@XmlAccessorType(XmlAccessType.FIELD)
public class SunstnRtktRespDTO {
    /**
     * 编码提取结果，如果为 0，则表示该次请求失败
     */
    @XmlAttribute(name = "ret_value")
    @XmlJavaTypeAdapter(Boolean2XmlAdapter.class)
    private Boolean ret_value;

    /**
     * 错语信息
     */
    @XmlAttribute(name = "err_info")
    private String err_info;

    /**
     * 票号
     */
    private String ticket;

    /**
     * 票证类型
     */
    private String ticket_type;

    /**
     * PNR
     */
    private String pnr;

    /**
     * 承运公司
     */
    private String carrier;

    /**
     * 出票日期
     */
    @XmlJavaTypeAdapter(LocalEnglishDate2XmlAdapter.class)
    private LocalDate issue_date;

    /**
     * 打票机号
     */
    private String etdz_device;

    /**
     * 乘客姓名
     */
    private String passenger;

    /**
     * 总价
     */
    private BigDecimal total_fare;

    /**
     * 票面价
     */
    private BigDecimal ticket_fare;

    /**
     * 税
     */
    private BigDecimal tax;

    /**
     * 余额价
     */
    private BigDecimal balance_fare;

    /**
     * 代理费  国内为金额，国际为费率（需除100）
     */
    private BigDecimal agent_rate;

    /**
     * 退票机号
     */
    private String refund_device;

    /**
     * 行程信息
     */
    @XmlElementWrapper(name = "voyages")
    @XmlElement(name = "voyage", type = SunstnRtktRouteRespDTO.class)
    private List<SunstnRtktRouteRespDTO> routes;
}
